<?php
namespace Plugin\Attractions\Broadcast\Schema\Broadcast_devices;

use Plugin\Attractions\Broadcast\Model\Broadcast_devices\BroadcastDevices;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 广播设备管理
 */
#[Schema(title: 'BroadcastDevicesSchema')]
class BroadcastDevicesSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: '主键ID', type: 'bigint')]
    public string $id;

    #[Property(property: 'device_name', title: '设备名称', type: 'varchar')]
    public string $device_name;

    #[Property(property: 'device_model', title: '设备型号', type: 'varchar')]
    public string $device_model;

    #[Property(property: 'device_brand', title: '设备品牌', type: 'varchar')]
    public string $device_brand;

    #[Property(property: 'device_sn', title: '设备序列号', type: 'varchar')]
    public string $device_sn;

    #[Property(property: 'longitude', title: '经度', type: 'double')]
    public string $longitude;

    #[Property(property: 'latitude', title: '纬度', type: 'double')]
    public string $latitude;

    #[Property(property: 'altitude', title: '海拔高度', type: 'double')]
    public string $altitude;

    #[Property(property: 'ip_address', title: 'IP地址', type: 'varchar')]
    public string $ip_address;

    #[Property(property: 'port', title: '端口号', type: 'int')]
    public string $port;

    #[Property(property: 'secret', title: '密钥', type: 'varchar')]
    public string $secret;

    #[Property(property: 'mac_address', title: 'MAC地址', type: 'varchar')]
    public string $mac_address;

    #[Property(property: 'online_status', title: '在线状态：1-离线，2-在线', type: 'tinyint')]
    public string $online_status;

    #[Property(property: 'last_online_time', title: '最后在线时间', type: 'timestamp')]
    public string $last_online_time;

    #[Property(property: 'device_group', title: '设备分组', type: 'varchar')]
    public string $device_group;

    #[Property(property: 'maintenance_status', title: '维护状态：1-正常，2-需要维护，3-维护中，4-报废', type: 'tinyint')]
    public string $maintenance_status;

    #[Property(property: 'remark', title: '备注', type: 'text')]
    public string $remark;




    public function __construct(BroadcastDevices $model)
    {
       $this->id = $model->id;
       $this->device_name = $model->device_name;
       $this->device_model = $model->device_model;
       $this->device_brand = $model->device_brand;
       $this->device_sn = $model->device_sn;
       $this->longitude = $model->longitude;
       $this->latitude = $model->latitude;
       $this->altitude = $model->altitude;
       $this->ip_address = $model->ip_address;
       $this->port = $model->port;
       $this->secret = $model->secret;
       $this->mac_address = $model->mac_address;
       $this->online_status = $model->online_status;
       $this->last_online_time = $model->last_online_time;
       $this->device_group = $model->device_group;
       $this->maintenance_status = $model->maintenance_status;
       $this->remark = $model->remark;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'device_name' => $this->device_name ,'device_model' => $this->device_model ,'device_brand' => $this->device_brand ,'device_sn' => $this->device_sn ,'longitude' => $this->longitude ,'latitude' => $this->latitude ,'altitude' => $this->altitude ,'ip_address' => $this->ip_address ,'port' => $this->port ,'secret' => $this->secret ,'mac_address' => $this->mac_address ,'online_status' => $this->online_status ,'last_online_time' => $this->last_online_time ,'device_group' => $this->device_group ,'maintenance_status' => $this->maintenance_status ,'remark' => $this->remark];
    }
}